package com.farm.wcp.util;

import javax.servlet.http.HttpSession;

import org.apache.commons.lang.StringUtils;

import com.farm.parameter.FarmParameterService;
import com.farm.web.WebUtils;

public class RemoteGoUrls {
	private static String STATECODE_SESSION_KEY = "STATECODE_NOCLEAR";

	/**
	 * 要返回的内部和外部url
	 * 
	 * @param session
	 * @param sysid     子系统id
	 * @param statecode 带回到子系统的参数,可以为空
	 * @return
	 */
	public static String getGoUrl(HttpSession session, String statecode) {
		return WebUtils.getlocalGoUrl(session, FarmParameterService.getInstance());
	}

	/**
	 * 将一个登录状态码缓存到session中
	 * 
	 * @param session
	 * @param statecode
	 */
	public static void saveStateCode(HttpSession session, String statecode) {
		if (StringUtils.isNotBlank(statecode)) {
			session.setAttribute(STATECODE_SESSION_KEY, statecode);
		}
	}
}
